package codeGen.core;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * JDBC操作
 */
public class ConnectionManager {

    public static Connection getConnection() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
//            return DriverManager.getConnection("jdbc:mysql://10.4.33.251:3306/biz?useEncoding=true&charsetEncoding=utf8", "reader1", "Reader12341");
            return DriverManager.getConnection("jdbc:mysql://10.4.33.251:3306/information_schema?useEncoding=true&charsetEncoding=utf8", "reader1", "Reader12341");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void close(Connection conn) {
        if (null != conn) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
